package com.vsoontech.demo.logincomponent;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.vsoontech.demo.componentlib.ILoginService;

/**
 * Des:
 *
 * @author kingpengLin
 * @since 2019/9/26 11:11
 */
public class LoginService implements ILoginService {

    @Override
    public void startLogin(Context context) {
        Intent intent = new Intent(context, LoginActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }

    @Override
    public Fragment getUserFragment(FragmentManager fragmentManager, int viewId, Bundle bundle) {
        UserFragment loginFragment = new UserFragment();
        loginFragment.setArguments(bundle);
        fragmentManager.beginTransaction().replace(viewId, loginFragment).commit();
        return loginFragment;
    }
}
